﻿namespace singleton
{
    /// <summary>
    /// 静态构造函数
    /// </summary>
    public class StaticConstructorSingleton
    {
        private static StaticConstructorSingleton _instance;
        static StaticConstructorSingleton()
        {
            //由CLR保证在第一次使用之前只调用一次
            _instance = new StaticConstructorSingleton();
        }
        private StaticConstructorSingleton()
        {
        }

        public static StaticConstructorSingleton Instance()
        {
            return _instance;
        }
    }
}
